<template>
  <el-dialog
    title="公式定义"
    v-model="open"
    width="500px"
    append-to-body
    @close="onCloseDidalog"
  >
    <div class="formula-list">
      <div  class="formula-list_item" v-for="item in list" :key="item.label">
        <div class="label">{{ item.label }}</div>
        <div class="value">
          <el-input v-model:value="item.value"></el-input>
        </div>
      </div>
    </div>
  </el-dialog>
</template>
<script setup lang="ts" name="updateFormulaModal">
  const open = ref(false);

  const list = ref([
    {label:"Spd(r/min)", value:"(Speed1 + Speed2) / 2"},
    {label:"Tq(Nm)", value:"Torque1 + Torque2"},
    {label:"Udc(V)", value:"Urmsl"},
    {label:"Idc(A)", value:"Irmsl"},
    {label:"机械功率(kW)", value:"Spd * Tq / 9550"},
    {label:"输入电功率(kW)", value:""},
    {label:"效率(%)", value:"(机械功率 / 输入电功率) * 100%"},
    {label:"补偿后电功率(kW)", value:"原有功率 - 电流平方 * 电阻"},
  ])
  function init(){
    open.value = true;
  }
  function onCloseDidalog() {
    open.value = false;
  }

  defineExpose({
    init
  });
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
.formula-list{
  &_item{
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    .label{
      width:140px;
      text-align: right;
      margin-right: 15px
    }
  }
}
</style>
